@import '../../styles/var.less';

.k-form {
  .k-form-item {
    margin-bottom: 24px;
    vertical-align: top;
    zoom: 1;
    color: var(--kui-color-font);

    // margin-bottom: 5px;
    .k-form-item {
      margin-bottom: 0;
      flex: 1;
      margin-left: 8px;

      &:first-child {
        margin-left: 0;
      }

      .k-col {
        flex: 1;
      }
    }
  }

  .k-form-item-label {
    text-align: right;
    box-sizing: border-box;
    font-size: 14px;
    display: flex;
    height: 32px;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    transition: all .3s ease-in-out;
    justify-content: flex-end;

    &::after {
      content: ':';
      padding: 0 8px 0 5px;
    }
  }

  .k-form-item-content {
    position: relative;
    min-height: 32px;
    display: flex;
    align-items: center;
    transition: all .3s ease-in-out;
  }

  .k-form-item-error-tip {
    position: absolute;
    top: 100%;
    left: 0;
    color: var(--kui-color-danger);
    line-height: 1.5;
    transform-origin: 0 0;
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
  }

  .k-form-item-required {
    .k-form-item-label {
      &::before {
        content: "*";
        display: inline;
        margin-right: 4px;
        line-height: 1;
        font-family: SimSun;
        font-size: 12px;
        color: var(--kui-color-danger);
      }
    }
  }

  .k-form-item-error {
    .k-input[mult].k-input-focus {
      border-color: var(--kui-color-danger);
      box-shadow: 0 0 0 2px var(--kui-color-danger-90);

    }

    .k-input,
    .k-input-focus,
    .k-textarea,
    .k-datepicker,
    .k-input-number {
      border-color: var(--kui-color-danger);

      &:hover,
      &:focus {
        border-color: var(--kui-color-danger);
        box-shadow: 0 0 0 2px var(--kui-color-danger-90);
      }
    }

    .k-select,
    .k-tree-select {
      border-color: var(--kui-color-danger);

      .k-select-arrow {
        color: var(--kui-color-danger);
      }
    }

    .k-radio-group .k-btn {
      border-color: var(--kui-color-danger);
    }

    .k-select-open .k-select,
    .k-tree-select-open .k-tree-select {
      box-shadow: 0 0 0 2px var(--kui-color-danger-90);
    }

    .k-datepicker-open {
      box-shadow: 0 0 0 2px var(--kui-color-danger-90);
    }
  }
}

.k-form-label-right {
  .k-form-item-label {
    // text-align: right;
    justify-content: flex-end;
  }
}

.k-form-lg {
  .k-form-item-label {
    height: 40px;
    font-size: 16px;
  }

  .k-form-item-content {
    min-height: 40px;
  }

  .k-form-item-error-tip {
    font-size: 14px;
  }
}

.k-form-vertical {
  .k-form-item {
    flex-direction: column;
  }

  .k-form-item-label {
    height: auto;
    justify-content: start;
    margin-bottom: 8px;

    &::after {
      display: none;
    }
  }
}

.k-form-inline {
  display: flex;
  flex-wrap: wrap;

  .k-form-item {
    flex: none;
    flex-wrap: nowrap;
    margin-right: 16px;
    margin-bottom: 18px;

    .k-form-item {
      margin-left: 0;
    }
  }
}

.k-form-lg {}

.k-form-sm {
  .k-form-item-label {
    height: 24px;
    font-size: 12px;
  }

  .k-form-item-content {
    min-height: 24px;
  }
}

@keyframes k-form-item-fade {
  0% {
    transform: scaleY(0);
    opacity: 0;
  }

  100% {
    transform: scaleY(1);
    opacity: 1;
  }
}


.k-form-item-fade-enter-active {
  animation: k-form-item-fade .3s;
}

.k-form-item-fade-leave-active {
  animation: k-form-item-fade .3s reverse;
}